#include "infectionprotection.h"

#include <QPalette>

InfectionProtection::InfectionProtection(QWidget *parent)
    : QWidget(parent)
{
    // Make the game full screen
    setWindowState(Qt::WindowFullScreen);

    // Set the background of the screen to be pure black, just in case of a render problem
    QPalette newPalette (palette());
    newPalette.setColor(QPalette::Background,Qt::black);
    setPalette(newPalette);

    //setup menu scene
    menuScene = new MenuScene(this);
    menuScene->startScene();
    QObject::connect(menuScene,SIGNAL(end(GameScene::GameScenes)),this,SLOT(sceneOver(GameScene::GameScenes)));

    //setup level scene
    level1 = new Level1(this);
    QObject::connect(level1,SIGNAL(end(GameScene::GameScenes)),this,SLOT(sceneOver(GameScene::GameScenes)));

}

InfectionProtection::~InfectionProtection()
{

}

void InfectionProtection::sceneOver(GameScene::GameScenes nextScene)
{
    if (nextScene == GameScene::endGame)
        close();
    if (nextScene == GameScene::levelScene)
        level1->startScene();
    else
        menuScene->startScene();
}
